package cn.funnyxb.powerremember;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
import cn.funnyxb.powerremember.pullMsg.beans.VersionInfo;
import cn.funnyxb.powerremember.pullMsg.beans.WebMsg;
import cn.funnyxb.powerremember.tts.TTSHolder;
import cn.funnyxb.powerremember.uis.task.TasksActivity;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.activityFrame.ActivitysHolder;
import cn.funnyxb.tools.appFrame.dataStructure.MessageCache;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;
import com.mobclick.android.MobclickAgent;

public class LogoActivity extends Activity
{
  private final int REQUESTCODE_TTS_STATUS_CHECK = 2;
  private int atLeastTime = 2000;
  private int freashMsgCacheInter = 500;
  private volatile boolean isLogoWorkComplete = false;
  private boolean isTtsWorkComplete = false;
  private boolean logoed = false;
  private volatile MessageCache<String> logomsgs = new MessageCache();
  private volatile boolean timeCompleted = false;
  private TextView tv;
  private volatile int waitFordialog = 0;
  private volatile boolean workCompleted = false;

  private void load()
  {
    if (!(this.logoed))
    {
      showLogo();
      this.logoed = true;
    }
    while (true)
    {
      Toast.makeText(this, 2131034113, 1).show();
      return;
      startApp();
    }
  }

  private void log(String paramString)
  {
    Debuger.log("logo", paramString);
  }

  private void prepareStartApp()
  {
    log("prepareStartApp,isTtsWorkComplete=" + this.isTtsWorkComplete + " ,isLogoWorkComplete" + this.isLogoWorkComplete);
    if ((!(this.isTtsWorkComplete)) || (!(this.isLogoWorkComplete)) || (this.waitFordialog > 0));
    while (true)
    {
      return;
      startApp();
    }
  }

  private void prepareUi(Activity paramActivity, int paramInt, String paramString)
  {
    RelativeLayout localRelativeLayout = new RelativeLayout(paramActivity);
    localRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    this.tv = new TextView(paramActivity);
    RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
    localLayoutParams.addRule(12);
    localLayoutParams.addRule(11);
    localLayoutParams.bottomMargin = 30;
    localLayoutParams.addRule(14);
    this.tv.setTextColor(-65536);
    this.tv.setTextSize(18.0F);
    if (paramString != null)
      this.tv.setText(paramString);
    localRelativeLayout.addView(this.tv, localLayoutParams);
    if (paramInt > 0);
    try
    {
      localRelativeLayout.setBackgroundResource(paramInt);
      paramActivity.getWindow().setFlags(1024, 1024);
      paramActivity.setContentView(localRelativeLayout);
      return;
    }
    catch (Exception localException)
    {
    }
  }

  private void showLogo()
  {
    new 1(this).execute(new Void[0]);
  }

  private void startApp()
  {
    MobclickAgent.onError(getApplicationContext());
    startActivity(new Intent(this, TasksActivity.class));
    finish();
  }

  private void startCheckTtsActivity()
  {
    App.getApp().initTTSHolder();
    Intent localIntent = new Intent();
    localIntent.setAction("android.speech.tts.engine.CHECK_TTS_DATA");
    startActivityForResult(localIntent, 2);
  }

  public void notifyDialogComplete()
  {
    this.waitFordialog -= 1;
    prepareStartApp();
  }

  public void notifyShowVersionDialog(VersionInfo paramVersionInfo)
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      this.waitFordialog = (1 + this.waitFordialog);
    }
  }

  public void notifyShowWebMsgDialog(WebMsg paramWebMsg)
  {
    if ((isFinishing()) || (isRestricted()));
    while (true)
    {
      return;
      this.waitFordialog = (1 + this.waitFordialog);
    }
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    String str = null;
    if (paramInt1 != 2)
      label15: return;
    switch (paramInt2)
    {
    default:
      App.getApp().getTTSHolder().setTTSState(110);
      str = getString(2131034179);
    case 1:
    case -1:
    case -2:
    case -3:
    case 0:
    }
    while (true)
    {
      if (!(this.isTtsWorkComplete));
      App.getApp().getTTSHolder().setTTSState(102);
      App.getApp().getTTSHolder().setTtsLoadFullCompleted();
      new AlertDialog.Builder(this).setTitle(2131034185).setMessage(getString(2131034180) + "\n" + str + "\n" + getString(2131034181)).setNegativeButton(2131034182, new 2(this)).create().show();
      break label15:
      log("ttsCheckResult=CHECK_VOICE_DATA_PASS");
      App.getApp().getTTSHolder().initTextToSpeech4TTSIsInstalled();
      this.isTtsWorkComplete = true;
      continue;
      str = getString(2131034175);
      App.getApp().getTTSHolder().setTTSState(106);
      continue;
      str = getString(2131034176);
      App.getApp().getTTSHolder().setTTSState(107);
      continue;
      str = getString(2131034177);
      App.getApp().getTTSHolder().setTTSState(108);
      continue;
      str = getString(2131034178);
      App.getApp().getTTSHolder().setTTSState(109);
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    load();
  }

  protected void onDestroy()
  {
    super.onDestroy();
  }

  protected void onPause()
  {
    super.onPause();
    MobclickAgent.onPause(this);
  }

  protected void onResume()
  {
    super.onResume();
    MobclickAgent.onResume(this);
    App.getApp().getActivitysHolder().regCurrentActivity(this);
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.LogoActivity
 * JD-Core Version:    0.5.3
 */